// DlgDelayProperty.cpp : implementation file
//

#include "stdafx.h"
#include "MotionControlSoftware.h"
#include "DlgDelayProperty.h"
#include "afxdialogex.h"


// CDlgDelayProperty dialog

IMPLEMENT_DYNAMIC(CDlgDelayProperty, CDialogEx)

CDlgDelayProperty::CDlgDelayProperty(CWnd* pParent /*=NULL*/)
	: CDialogEx(CDlgDelayProperty::IDD, pParent)
	, m_iDelayTime(0)
{
	m_DelayBlock = NULL;
	m_pDelay = NULL;
}

CDlgDelayProperty::~CDlgDelayProperty()
{
}

void CDlgDelayProperty::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT_DELAYTIME, m_iDelayTime);
}


BEGIN_MESSAGE_MAP(CDlgDelayProperty, CDialogEx)
	ON_WM_SHOWWINDOW()
END_MESSAGE_MAP()


// CDlgDelayProperty message handlers


BOOL CDlgDelayProperty::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  Add extra initialization here
	if (m_DelayBlock != NULL)
	{
		CGraph* pGraph = m_DelayBlock->GetHead();
		m_pDelay = (CDelay*)(pGraph->GetHead());
		m_iDelayTime = m_pDelay->m_iDelayTime;
	}

	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

bool CDlgDelayProperty::UpdateParam()
{
	UpdateData();
	if (m_pDelay != NULL)
	{
		m_pDelay->m_iDelayTime = m_iDelayTime;
		return true;
	}
	return false;
}


void CDlgDelayProperty::OnShowWindow(BOOL bShow, UINT nStatus)
{
	CDialogEx::OnShowWindow(bShow, nStatus);

	// TODO: Add your message handler code here
	if (m_DelayBlock != NULL)
	{
		CGraph* pGraph = m_DelayBlock->GetHead();
		m_pDelay = (CDelay*)(pGraph->GetHead());
		m_iDelayTime = m_pDelay->m_iDelayTime;
	}

	UpdateData(FALSE);
}
